import React from 'react'
import { connect } from 'react-redux'
import { WriterItem } from '../style'

class Writer extends React.PureComponent {
  render() {
    const { list } = this.props
    return (
      <div>
        {
          list.map((item) => (
            <WriterItem key={item.get('id')}>
              <img className="avatar" src={item.get('avatar')} alt="" />
              <div className="nickname">{item.get('nickname')}</div>
              <div className="desc">
                <span>写了{item.get('writen')}</span>
                <span>写了{item.get('like_count')}k喜欢</span>
              </div>
            </WriterItem>
          ))
        }
      </div>
    )
  }
}

const mapStoreToProps = (state) => {
  return (
    {
      list: state.getIn(['home', 'writerList'])
    }
  )
}
export default connect(mapStoreToProps, null)(Writer)